package com.just.gameapp.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.just.gameapp.entity.Match;
import com.just.gameapp.mapper.MatchMapper;
import com.just.gameapp.service.MatchService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
 * @author zyr
 * @date 2024/6/18 下午3:02
 * @Description
 */
@Slf4j
@Service
public class MatchServiceImpl extends ServiceImpl<MatchMapper, Match> implements MatchService {
    @Resource
    private MatchMapper matchMapper;

    @Override
    public List<Match> getList() {
        return matchMapper.getList();
    }

    @Override
    public List<Match> getMatchByDate(String date) {
        LambdaQueryWrapper<Match> query = new LambdaQueryWrapper<>();
        query.ge(Match::getMatchTime, "2024-"+date + " 00:00:00")
                .le(Match::getMatchTime, "2024-"+date + " 23:59:59");
        return matchMapper.selectList(query);
    }
}
